#ifndef HID_DEVICE_H
#define HID_DEVICE_H

#include <hidapi/hidapi.h>

#include "deviceinterface.h"


class HIDDevice : public DeviceInterface
{
public:
    static std::vector<DevInfo> getDeviceInfo();
public:
    HIDDevice(const std::string &path);

    ~HIDDevice();

    bool open() override;

    void close() override;

    bool isOpen() const override;

    void write(const std::vector<uint8_t>& data, const uint16_t &timeout) override;

    std::string getDescription() const override;
protected:
    void errorOccurred(int e);
private:
    hid_device *m_dev;
};

#endif // HID_DEVICE_H
